# gozerplugs/mysqlkeepalive
#
#

from gozerbot.users import users
from gozerbot.utils.log import rlog
from gozerbot.threads.threadloop import ThreadSleeper
from gozerbot.config import config

import time

class PingLoop(ThreadSleeper):


    def handle(self):

        if config['dbtype'] == 'mysql':
            users.size()
            rlog(10, 'mysqlkeepalive', 'pinged database')

pingloop = PingLoop(timeout=1800)

def init():
    pingloop.start()

def shutdown():
    pingloop.stop()
